<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //1.创建Ajax对象
        var xhr = new XMLHttpRequest();
        //2.告诉ajax请求地址以及请求方式
        xhr.open('get','http://www.example.com');
        //3.发送请求
        xhr.send();
        //4.获取服务器端给客户端的响应数据
        xhr.onload = function(){
            console.log(xhr.responseText);
        }
        
    </script>
</body>
</html>